package com.lujinqi.egroup.consumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.lujinqi.egroup.api.model.User;
import com.lujinqi.egroup.api.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lujinqi
 * @date 2018/10/22
 */
@RestController
public class UserController {

    @Reference(
            version = "${service.version}",
            application = "${dubbo.application.id}",
            registry = "${dubbo.registry.id}"
    )
    private UserService userService;

    @GetMapping("/user/{id}")
    public User getById(@PathVariable(name = "id") Long id) {
        return userService.getById(id);
    }
}

